#include <iostream>
#include <pthread.h>
#include <unistd.h>

void* func(void* s)
{
    int cnt = 5;
    while(cnt--)
    {
        std::cout << "我是新线程" << (const char*)s << std::endl;
        sleep(1);
    }
    return (void*)100;
}

int main()
{
    pthread_t n = 0;
    pthread_create(&n, nullptr, func, (void*)"abc");

    int cnt = 5;
    while(cnt--)
    {
        std::cout << "我是主线程" << std::endl;
        sleep(1);
    }

    int* ret = 0;
    pthread_join(n, (void**)&ret);

    std::cout << (long long)ret << std::endl;
    return 0;
}